﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/css/angularStyle.css" />
    <link rel="stylesheet" href="/static/css/common/reset.css" />
    <link rel="stylesheet" href="/static/css/associate.css" />
    <link rel="stylesheet" href="/static/css/sweetalert.min.css" />
    <title>宾果高校</title>
</head>
<body>
    <div class="inviteDetail">
        <div id="divHeader"></div>
        <section class="main pt10">
            <ul class="support-ul pt10 clearfix">
                <li>首页</li>
                <li>社团</li>
                <li>赞助筹备</li>
                <li>我的邀请</li>
                <li>详情查看</li>
            </ul>
        </section>
        <div ng-app="myApp" ng-cloak>
            <div ng-controller="sponsorContractCtrl" ng-model="names">
                <section class="main">
                    <div class="support-activity">
                        <h1 class="f20 textcenter">{{names.ProjectName}}</h1>
                        <h2 class="textcenter mt10">{{names.CreateDate}}      <span class="colorRed">200</span>人已浏览</h2>
                        <h3 class="support-act-title f16 mb10">活动简介</h3>
                        <article class="line2">
                            <p ng-bind-html="names.Introduction | to_trusted"></p>
                        </article>
                        <a href="/release-detail.html?id={{names.ProjectID}}" class="support-act-editBtn">查看活动详情</a>
                    </div>
                </section>
                <section class="main">
                    <ul class="support-list agent">
                        <li class="clearfix">
                            <div class="support-list-left fl">
                                <div class="support-lleft-top clearfix">
                                    <p class="fl"><label id="lblName">筹备社团</label>：{{names.Name}}</p>
                                    <p class="fr">{{names.ContractDate}}</p>
                                </div>
                                <div id="divCompany" class="support-lleft-top mt5 clearfix hide">
                                    <p class="fl">赞助企业：{{names.CreatorName}}</p>
                                </div>
                                <div class="support-lleft-bottom">
                                    <label class="veraT f16 colorRed" id="lblContent">活动要求：</label>
                                    <p style="border: 1px solid; height: 110px; overflow-y: scroll" ng-bind-html="names.Feedback | to_trusted"></p>
                                </div>
                            </div>
                            <div class="support-list-right fr">
                                <div class="support-lright-top">
                                    <h2 class="support-lrtop-money">
                                        <p><label id="lblMoney">提供赞助金</label>：<label class="colorLGray f24">¥</label><span>{{names.Amount}}</span></p>
                                        <p class="{{names.PercentageMoney != 'NULL' ? 'show' : 'hide' }}">代理官奖金：<label class="colorLGray f24">¥</label><span>{{names.PercentageMoney}}</span></p>
                                    </h2>
                                    <div class="clearfix">
                                        <div class="support-lrtop-text fl">
                                            <p><label id="lblContractor">社团联系人</label>:<span>{{names.Creator}}</span></p>
                                            <p><label>联系电话:</label><span>{{names.CreatorPhone}}</span></p>
                                            <p><label>QQ:</label><span>{{names.CreatorQQ}}</span></p>
                                        </div>
                                        <div class="support-lrtop-text fr" ng-if="names.UserType == 'Company'">
                                            <p><label>代理官:</label><span>{{names.AgentName}}</span></p>
                                            <p><label>联系电话:</label><span>{{names.AgentPhone}}</span></p>
                                            <p><label>QQ:</label><span>{{names.AgentQQ}}</span></p>
                                        </div>
                                        <div class="support-lrtop-text fr" ng-if="names.UserType == 'Agent'">
                                            <p><label>企业联系人:</label><span>{{names.ContractorName}}</span></p>
                                            <p><label>联系电话:</label><span>{{names.ContractorPhone}}</span></p>
                                            <p><label>QQ:</label><span>{{names.ContractorQQ}}</span></p>
                                        </div>
                                    </div>
                                </div>
                                <div class="support-lright-bottom">
                                    <a href="javascript:void(0);" tag="{{names.ContractID}}" onclick="Update(this, 'Effective')" ng-if="(names.UserType == 'Company' || names.UserType == 'Student') && names.CreatorType == 'Company' && names.Status == 'Confirmed' && names.SubStatus == 'SponMoneyChanged'" class="support-lrbottom-btn agree w50 fl">同意修改后的金额</a>
                                    <a href="javascript:void(0);" ng-if="names.Status == 'Effective'" class="support-lrbottom-btn agree w100 fl">已经同意，并生成合同</a>
                                    <a href="javascript:void(0);" ng-if="names.SubStatus == 'StudentCancelled'" class="support-lrbottom-btn refuse w100 fl">社团拒绝邀请</a>
                                    <a href="javascript:void(0);" ng-if="names.SubStatus == 'CompanyCancelled'" class="support-lrbottom-btn refuse w100 fl">企业取消邀请</a>
                                    <a href="javascript:void(0);" tag="{{names.ContractID}}" ng-if="(names.UserType == 'Company' || names.UserType == 'Student') && names.Status == 'Confirmed'" onclick="Update(this, 'Cancelled')" class="support-lrbottom-btn refuse w50 fl">取消，希望下次合作</a>
                                    <a href="javascript:void(0);" ng-if="(names.UserType == 'Company' || names.UserType == 'Student') && names.Status == 'Confirmed' && names.SubStatus == 'Pending'" class="support-lrbottom-btn agree w50 fl">等待确定中</a>
                                    <a href="javascript:void(0);" ng-if="(names.UserType == 'Agent' && names.Status == 'Confirmed' && names.SubStatus == 'Pending') || (names.UserType == 'Agent' && names.CreatorType == 'Student' && names.Status == 'Confirmed' && names.SubStatus == 'SponMoneyChanged')" class="support-lrbottom-btn agree w100 fl">等待社团确定中</a>
                                    <a href="javascript:void(0);" ng-if="(names.UserType == 'Company' || names.UserType == 'Student') && names.CreatorType == 'Student' && names.Status == 'Confirmed' && names.SubStatus == 'SponMoneyChanged'" class="support-lrbottom-btn btop agree w50 fl">等待社团确定中</a>
                                    <a href="javascript:void(0);" ng-if="(names.UserType == 'Company' || names.UserType == 'Student') && names.CreatorType == 'Student' && names.Status == 'Confirmed' && (names.SubStatus == 'Pending' || names.SubStatus == 'SponMoneyChanged')" onclick="ShowUpdate();" class="support-lrbottom-btn edit w100 fl">修改提供赞助金</a>

                                </div>
                            </div>
                        </li>
                    </ul>
                </section>
            </div>
        </div>
        <div id="divFooter"></div>
    </div>
    <!--遮罩层-->
    <div class="mask hide"></div>
    <!--提交反馈意见-->
    <div class="popBox contractBox minBox hide" id="supportEditBox">
        <h1 class="contractBox-title">修改赞助金<a href="javascript:void(0)" class="contractBox-title-close"></a></h1>
        <div class="contractBox-content">
            <p class="contractBox-content-url">
                <label>提供赞助金：</label>
                <input type="text" id="txtAmount" placeholder="请输入修改金额" />
            </p>
            <div class="clearfix">
                <a href="javascript:void(0)" class="up-hb-submit cancel">取消</a>
                <a href="javascript:void(0)" onclick="UpdateAmount(this)" class="up-hb-submit confirm">确认修改</a>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript" src="/static/js/ref/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/js/self/common.js"></script>
<script type="text/javascript" src="/static/js/ref/angular.min.js"></script>
<script type="text/javascript" src="/static/js/ref/sweetalert.min.js"></script>
<script>

    var param = common.getUrlArgStr();
    if (!common.checkValue(param.id))
        window.location = "invite.html";

    var userType = common.GetUserType();

    if (!common.checkValue(userType))
        window.location = "/login.html";

    switch (userType) {
        case 2:
            $("#lblName").html("赞助企业");
            $("#lblContent").html("社团承诺");
            $("#lblMoney").html("所需赞助金");
            $("#lblContractor").html("企业联系人");
            break;
        case 3:
            //$("#lblName").html("赞助企业");
            $("#divCompany").show();
            break;
    }

    $("#divHeader").load("/wuc/header.html");
    $("#divFooter").load("/wuc/footer.html");

    common.CreateController({ name: 'sponsorContractCtrl', url: '/api/project/GetSponsorContract?id=' + param.id, objType: 'dict', htmlFilter: true });

    function Update(obj, status) {

        var values = {};
        values.ContractID = $(obj).attr("tag");
        values.Status = status;

        common.commonAjax({ type: 'Post', url: '/api/project/UpdateContractStatus', data: values, sMethod: AfterUpdated, alert: true });
    }

    function UpdateAmount(obj) {

        var values = {};
        values.ID = param.id;
        values.Amount = $("#txtAmount").val();

        common.commonAjax({ type: 'Post', url: '/api/project/UpdateContractAmount', data: values, sMethod: AfterUpdated, alert: true });
    }

    function AfterUpdated(ctx) {
        if (ctx == null) {
            common.alertMessage("无数据.");
            return;
        }

        window.location = "invite.html";
    }

    function ShowUpdate() {
        $(".mask,#supportEditBox").show();
        e.stopPropagation();
    }

    $(".contractBox-title-close, .up-hb-submit.cancel").on('click', function (e) {
        $(".mask,#supportEditBox,cancel").hide();
        e.stopPropagation();
    })

</script>